﻿
layui.use(['form', 'layer'], function () {
    var form = layui.form,
        layer = layui.layer;

    $(function () {
        loadList();
    });
});

//查询
function search() {
    var queryParams = {
        "s_0_UserAccount|LoginIP|LoginAddress": $('#tbKey').val()
    };
    $.extend(true, _table.InitOptions.params, queryParams); //分页带查询参数
    _table.reload();
}

//初始化表格
function loadList() {
    _table.init({
        elem: '#table',
        url: 'LoginLog.ashx',
        contentType: "application/x-www-form-urlencoded", /**支持跨域**/
        pageSize: 15, //单页记录数
        striped: false, //是否显示行间隔色
        checkboxHeader: true,
        singleSelect: false,
        onLoadSuccess: function (data) {
        },
        params: {
            PostType: 'list',
            ActionType: 'LoginLog',
            rmd: Math.random()
        }
    });
}

//格式化序号
function formatterNum(value, row, index) {
    //获取每页显示的数量
    var pageSize = $('#table').bootstrapTable('getOptions').pageSize;
    //获取当前是第几页
    var pageNumber = $('#table').bootstrapTable('getOptions').pageNumber;
    //返回序号，注意index是从0开始的，所以要加上1
    return (pageSize * (pageNumber - 1) + index + 1);
}
